package com.example.interceptor;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.concurrent.TimeUnit;

@RestController
public class TimeController {
    /***
     * 写一个Spring MVC拦截器(HandlerInterceptor)对如下方法的执行进行拦截,
     * 要求此方法只能在15:00之后访问,请问如何实现.
     * @return
     */
     @GetMapping("/api/time")
     public Long doTime() throws InterruptedException {
         TimeUnit.SECONDS.sleep(2);
         return System.currentTimeMillis();
     }
}
